import request from '@/utils/request'

export function getRoleList(params) {
  return request({
    url: '/roles/page',
    method: 'get',
    params
  })
}

export function addRole(data) {
  return request({
    url: '/roles/add',
    method: 'post',
    data
  })
}

export function updateRole(data) {
  return request({
    url: '/roles/update',
    method: 'post',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: '/roles/delete',
    method: 'post',
    data: { id }
  })
}

export function getRoleMenus(roleId) {
  return request({
    url: '/roles/menu',
    method: 'get',
    params: { roleId }
  })
}

export function setRoleMenus(roleId, menuIdList) {
  return request({
    url: '/roles/setRolemenu',
    method: 'post',
    data: { roleId, menuIdList }
  })
} 